package constant

import "a-common/config"

var (
	APP_NAME        = config.Config.App.Name
	LOGIN_SESSION   = APP_NAME + ":login:session:" // 用户信息缓存
	LOGIN_ROLE      = APP_NAME + ":login:role:"    // 角色权限缓存
	PWD_ERR_CNT_KEY = APP_NAME + ":pwd_err_cnt:"   // 登录账户密码错误次数

	LOGIN_TOKEN_KEY   = "Authorization:login:token:" // 登录用户 redis key
	ONLINE_TOKEN_KEY  = "online_tokens:"             // 在线用户 redis key
	CAPTCHA_CODE_KEY  = "captcha_codes:"             // 验证码 redis key
	SYS_CONFIG_KEY    = "sys_config:"                // 参数管理 cache key
	SYS_DICT_KEY      = "sys_dict:"                  // 字典管理 cache key
	REPEAT_SUBMIT_KEY = "repeat_submit:"             // 防重提交 redis key
	RATE_LIMIT_KEY    = "rate_limit:"                // 限流 redis key
)

const (
	TOKEN        = "token"
	NEW_TOKEN    = "newToken"
	USER_LOGIN   = "login:"
	TOKEN_NAME   = "Authorization"
	TOKEN_PREFIX = "Bearer "

	HTTP  = "http://"
	HTTPS = "https://"
	WWW   = "www."

	TIMESTAMP_STR = "2006-01-02 15:04:05"

	PC       = "pc"       // pc端
	APP      = "app"      // app端
	XCX      = "xcx"      // 小程序端
	SYS_USER = "SYS_USER" // 平台内系统用户的唯一标志

	T = "1" // 是
	F = "0" // 否
	Y = "Y" // 是
	N = "N" // 否

	TYPE_DIR    = "M"          // 菜单类型（目录）
	TYPE_MENU   = "C"          // 菜单类型（菜单）
	TYPE_BUTTON = "F"          // 菜单类型（按钮）
	LAYOUT      = "Layout"     // Layout组件标识
	PARENT_VIEW = "ParentView" // ParentView组件标识
	INNER_LINK  = "InnerLink"  // InnerLink组件标识
	ADMIN_ID    = 1            // 超管ID
	ADMIN       = "admin"      // 超管名
)
